//
//  NSDate+Util.m
//  Tourism
//
//  Created by 鲁万玺 on 2017/8/16.
//  Copyright © 2017年 Lwx. All rights reserved.
//

#import "NSDate+Util.h"

@implementation NSDate (Util)

- (NSString *)getConstellations
{
    NSString *constellations;
    
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"MM-dd"];
    NSString *dateStr = [formatter stringFromDate:self];
    NSDate *date = [formatter dateFromString:dateStr];
    if([[formatter dateFromString:@"3-21"] earlierDate:date] == [formatter dateFromString:@"3-21"]&&[[formatter dateFromString:@"4-20"] earlierDate:date] == date)
    {
        constellations = @"白牛座";
    }
    else if([[formatter dateFromString:@"4-21"] earlierDate:date]==[formatter dateFromString:@"4-21"]&&[[formatter dateFromString:@"5-21"] earlierDate:date]==date)
    {
        constellations = @"金牛座";
    }
    else if([[formatter dateFromString:@"5-22"] earlierDate:date]==[formatter dateFromString:@"5-22"]&&[[formatter dateFromString:@"6-21"] earlierDate:date]==date)
    {
        constellations = @"双子座";
    }
    else if([[formatter dateFromString:@"6-22"] earlierDate:date]==[formatter dateFromString:@"6-22"]&&[[formatter dateFromString:@"7-22"] earlierDate:date]==date)
    {
        constellations = @"巨蟹座";
    }
    else if([[formatter dateFromString:@"7-23"] earlierDate:date]==[formatter dateFromString:@"7-23"]&&[[formatter dateFromString:@"8-23"] earlierDate:date]==date)
    {
        constellations = @"狮子座";
    }
    else if([[formatter dateFromString:@"8-24"] earlierDate:date]==[formatter dateFromString:@"8-24"]&&[[formatter dateFromString:@"9-23"] earlierDate:date]==date)
    {
        constellations = @"处女座";
    }
    else if([[formatter dateFromString:@"9-24"] earlierDate:date]==[formatter dateFromString:@"9-24"]&&[[formatter dateFromString:@"10-23"] earlierDate:date]==date)
    {
        constellations = @"天秤座";
    }
    else if([[formatter dateFromString:@"10-24"] earlierDate:date]==[formatter dateFromString:@"10-24"]&&[[formatter dateFromString:@"11-22"] earlierDate:date]==date)
    {
        constellations = @"天蝎座";
    }
    else if([[formatter dateFromString:@"11-23"] earlierDate:date]==[formatter dateFromString:@"11-23"]&&[[formatter dateFromString:@"12-21"] earlierDate:date]==date)
    {
        constellations = @"射手座";
    }
    else if([[formatter dateFromString:@"12-22"] earlierDate:date]==[formatter dateFromString:@"12-22"]&&[[formatter dateFromString:@"1-20"] earlierDate:date]==date)
    {
        constellations = @"摩羯座";
    }
    
    else if([[formatter dateFromString:@"1-21"] earlierDate:date]==[formatter dateFromString:@"1-21"]&&[[formatter dateFromString:@"2-19"] earlierDate:date]==date)
    {
        constellations = @"水瓶座";
    }
//    if([[formatter dateFromString:@"2-20"] earlierDate:date]==[formatter dateFromString:@"2-20"]&&[[formatter dateFromString:@"3-20"] earlierDate:date]==date)
    else
    {
        constellations = @"双鱼座";
    }
    
    return constellations;
}

@end
